package metamodels;

import java.util.HashSet;
import java.util.Set;

import parser.generic.Node;


public class ProperMetamodel extends Node {

	Identifier name;
	Classifiers classifiers;
	
	public ProperMetamodel(Identifier identifier, Classifiers classifiers) {
		name = identifier;
		this.classifiers = classifiers;
	}

	@Override
	public String toString() {
		return "metamodel " + name + "{\n" + classifiers + "\n}"; 
	}

	public String getIdentifiers() {
		Set<String> ids = new HashSet<String>();
		
//		ids.add(name.toString());
		
		for(Classifier c : classifiers.getClassifiers())
			ids.addAll(c.getIdentifiers());
		
		// get rid of basic data type ids
		ids.remove("bool");
		ids.remove("string");
		ids.remove("int");
		ids.remove("real");
		
		String out = "";
		for (String id : ids)
			out += id + "\n | ";
		
		return out.substring(0, out.length()-2);
	}

	public String getInheritanceRules() {
		
		return classifiers.getInheritanceRules();
	}

	public String getAttributeDeclRules() {
		return classifiers.getAttributeDeclRules();
	}

	public String getEnumRules() {
		return classifiers.getEnumRules();
	}

	public String getEnumValuesRule() {
		return classifiers.getEnumValuesRule();
	}
}
